# BAM storage engine plugin
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# Avoid warnings in higher versions
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.6)
 CMAKE_POLICY(VERSION 2.8)
endif()

MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
SET(INSTALL_PLUGINDIR .)
include(plugin)
include(mysql_version)
include(dtrace)
include(install_macros)

include_directories("/usr/include/mysql")
include_directories("/usr/include/mysql/private")
SET(BAM_PLUGIN_STATIC "bam_storage")
SET(BAM_PLUGIN_DYNAMIC "bam_storage")
SET(BAM_SOURCES ha_bam.cc ha_bam.h bam_data.cc bam_data.h)

MYSQL_ADD_PLUGIN(bam_storage ${BAM_SOURCES} STORAGE_ENGINE MODULE_ONLY)

#target_link_libraries(bam_storage z)
find_package( ZLIB REQUIRED )
if ( ZLIB_FOUND )
    include_directories( ${ZLIB_INCLUDE_DIRS} )
    target_link_libraries( bam_storage ${ZLIB_LIBRARIES} )
endif( ZLIB_FOUND )
target_link_libraries(bam_storage bam)
target_link_libraries(bam_storage z)
#target_link_libraries(bam_storage mysql)
target_link_libraries(bam_storage mysqlclient)
